<?php

require_once(sfConfig::get('sf_lib_dir').'/filter/base/BaseFormFilterPropel.class.php');

/**
 * facturas filter form base class.
 *
 * @package    gescell
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfPropelFormFilterGeneratedTemplate.php 16976 2009-04-04 12:47:44Z fabien $
 */
class BasefacturasFormFilter extends BaseFormFilterPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'clientes_id'           => new sfWidgetFormPropelChoice(array('model' => 'clientes', 'add_empty' => true)),
      'numero_de_comprobante' => new sfWidgetFormFilterInput(),
      'credito'               => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'pagado'                => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'guardado'              => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'eliminado'             => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'anulado'               => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'fecha'                 => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
      'totalneto'             => new sfWidgetFormFilterInput(),
      'exentas'               => new sfWidgetFormFilterInput(),
      'totaliva'              => new sfWidgetFormFilterInput(),
      'total'                 => new sfWidgetFormFilterInput(),
      'created_at'            => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
      'updated_at'            => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
    ));

    $this->setValidators(array(
      'clientes_id'           => new sfValidatorPropelChoice(array('required' => false, 'model' => 'clientes', 'column' => 'id')),
      'numero_de_comprobante' => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'credito'               => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'pagado'                => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'guardado'              => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'eliminado'             => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'anulado'               => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'fecha'                 => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'totalneto'             => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'exentas'               => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'totaliva'              => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'total'                 => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'created_at'            => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'updated_at'            => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
    ));

    $this->widgetSchema->setNameFormat('facturas_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'facturas';
  }

  public function getFields()
  {
    return array(
      'id'                    => 'Number',
      'clientes_id'           => 'ForeignKey',
      'numero_de_comprobante' => 'Number',
      'credito'               => 'Boolean',
      'pagado'                => 'Boolean',
      'guardado'              => 'Boolean',
      'eliminado'             => 'Boolean',
      'anulado'               => 'Boolean',
      'fecha'                 => 'Date',
      'totalneto'             => 'Number',
      'exentas'               => 'Number',
      'totaliva'              => 'Number',
      'total'                 => 'Number',
      'created_at'            => 'Date',
      'updated_at'            => 'Date',
    );
  }
}
